package jp.sourceforge.akjrcp.text_douga.rcp;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	private IWorkbenchAction exitAction;
	private IWorkbenchAction preference;
	private IWorkbenchAction undoAction;
    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
        super(configurer);
    }


	protected void makeActions(final IWorkbenchWindow window) {
		// Creates the actions and registers them.
		// Registering is needed to ensure that key bindings work.
		// The corresponding commands keybindings are defined in the plugin.xml
		// file.
		// Registering also provides automatic disposal of the actions when
		// the window is closed.

		exitAction = ActionFactory.QUIT.create(window);
		register(exitAction);
		
		preference =ActionFactory.PREFERENCES.create(window);
		register(preference);
		
		
		undoAction = ActionFactory.UNDO.create(window);
		register(undoAction);
		
		/*
		intro =ActionFactory.INTRO.create(window);
		intro.setText(Messages.getString("akjbetas.intro"));
		register(intro);
		*/
	
		
		
	}

	protected void fillMenuBar(IMenuManager menuBar) {
		
		MenuManager fileMenu = new MenuManager(Messages.getString("file"),
				IWorkbenchActionConstants.M_FILE);
		
		
		
		menuBar.add(fileMenu);
		
		
		fileMenu.add(exitAction);
		
		MenuManager editMenu = new MenuManager(Messages.getString("edit"),
				IWorkbenchActionConstants.M_EDIT);
		
		
		
		//menuBar.add(editMenu);
		//editMenu.add(undoAction);
		
		
		 MenuManager menu = new MenuManager(Messages.getString("window"), 
		 	        IWorkbenchActionConstants.M_WINDOW);
		 	   
		 	    
		 
		
		 	   
		 	   menuBar.add(menu);
		 	   menu.add(preference);
		 	  //menu.add(intro);
		 	  
		 	  MenuManager toolsMenu = new MenuManager(Messages.getString("menu.tools"),"tools");
		 	  menuBar.add(toolsMenu);
		 	  
		 	   
		 	  MenuManager helpMenu = new MenuManager(Messages.getString("help"), 
			 	        IWorkbenchActionConstants.M_HELP);
			 	   
			 	    
			 
			 	   
			 	   menuBar.add(helpMenu);
			 	   
			 	
			 	 
		
		 	  
		 	   
	}
    
}

